﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ScriptEditor.Commands
{
    class Command_Investigation : Command
    {
        public string bgName
        {
            get
            {
                return Value1;
            }
            set
            {
                Value1 = value;
            }
        }
        public float duration
        {
            get
            {
                return float.TryParse(Value2, out float result) ? result : 0.5f;
            }
            set
            {
                Value2 = value.ToString();
            }
        }
        public Vector2 bgPosition
        {
            get
            {
                return StringToVector2(Value3);
            }
            set
            {
                Value3 = Vector2ToString(value);
            }
        }
        public Vector2 bgScale
        {
            get
            {
                return StringToVector2(Value4);
            }
            set
            {
                Value4 = Vector2ToString(value);
            }
        }
        public string investSession
        {
            get
            {
                return Value5;
            }
            set
            {
                Value5 = value;
            }
        }
        public Ease easeType
        {
            get
            {
                return Enum.TryParse(Value6, out Ease result) ? result : Ease.Linear;
            }
            set
            {
                Value6 = value.ToString();
            }
        }
        public Command_Investigation()
        {
            CommandType = COMMANDTYPE.Investigation;
            bgName = "请输入背景名称";
            bgPosition = new Vector2 { x = 0, y = 0 };
            bgScale = new Vector2 { x = 1, y = 1 };
            duration = 0.5f;
            easeType = Ease.Linear;
            investSession = "请输入探查名称";
            Wait = true;
        }
        public Command_Investigation(string BgName, Vector2 BgPosition, Vector2 BgScale, float Duration, Ease EaseType, string InvestSession)
        {
            CommandType = COMMANDTYPE.Investigation;
            bgName = BgName;
            bgPosition = BgPosition;
            bgScale = BgScale;
            duration = Duration;
            easeType = EaseType;
            investSession = InvestSession;
            Wait = true;
        }
        public override string ToString()
        {
            return CommandType.ToString() + ":\n" + "开始探查:" + investSession + "在" + bgName;
        }
    }
}
